import 'package:flutter/material.dart';
import 'package:x3_base_package/x3_base_package.dart';
import 'package:x3_business_core/common_components/business_task_item.dart';
import 'package:x3_business_core/common_components/business_task_state.dart';

/// author：william on 2021/3/18 09:52
/// email：362661044@qq.com
///
class BusinessFollowMainOrderModel {
  final String billsName;
  final int state;
  final String billsTag;
  final String sureName;
  String sureDate;
  String beginDate;
  String endDate;
  String rangeDate;
  BusinessFollowMainOrderModel({
    @required this.billsName,
    @required this.state,
    @required this.billsTag,
    @required this.sureName,
    @required String beginDate,
    @required String endDate,
    @required String sureDate,
  }) {
    this.beginDate = BaseTransformUtil.stringToDate(beginDate);
    this.endDate = BaseTransformUtil.stringToDate(endDate);
    this.sureDate = BaseTransformUtil.stringToDateTimeStamp(sureDate,isNeedShowSecond: false);
    this.rangeDate = this.beginDate + ' ~ ' + this.endDate;
  }
}

class BusinessFollowMainOrder extends StatelessWidget {
  final BusinessFollowMainOrderModel model;
  const BusinessFollowMainOrder({Key key, @required this.model}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return BaseCardComponent(
      child: BusinessTaskItem(
        title: model.billsName ?? '',
        state: BusinessTaskState(state: model.state),
        subRowList: [
          BaseComponentUtils.buildTextSpanWidget(['有效日期:', model.rangeDate]),
          BaseComponentUtils.buildTextSpanWidget(['描述:', model.billsTag]),
          BaseComponentUtils.buildTextSpanWidget(['提交人:', model.sureName]),
          BaseComponentUtils.buildTextSpanWidget(['提交日期:', model.sureDate]),

        ],
      ),
    );
  }
}
